//dataService.js

async function Fetch(endpoint, params){
	const response = await fetch(`http://localhost:3000/api${endpoint}`, {
	  method: 'POST',
	  headers: {
	    'Content-Type': 'application/json'
	  },
	  body: params
	});
	console.log('数据获取成功\n', response);
	const results = await response.json();
}

export async function Login(authType, info, password){
	const response = await Fetch('/data/login', [authType, info, password]);
	if (!response.ok) throw new Error('数据获取失败');
	return response;
}

export async function Signin(tele, email, password){
	const response = await Fetch('/data/signin', [tele, email, passwordd]);
	if (!response.ok) throw new Error('数据获取失败');
	return response;
}